
"""
First run below command to get ntp.xml file
./masscan -pU:123 -oX ntp.xml --rate 160000 101.0.0.0-120.0.0.0
Then run this script to get ntp_ip.txt file
"""

with open("ntp_ip.txt","w") as f:
    with open("ntp.xml","r") as xml:
        import re
        for line in xml.readlines():
            m = re.match(r".*<address addr=\"(\d+\.\d+\.\d+\.\d+)\"",line)
            if m: f.write(m.group(1)+"\n")



